package com.bf;

import com.bf.utils.BfThreadPoolNoReturnUtils;
import com.bf.utils.BfThreadPoolReturnUtils;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;

import java.util.List;

@SpringBootTest
public class test {
    @Test
    public  void main() {
        List<String> run = new BfThreadPoolReturnUtils<String>("1")
                .addFunctions((i) -> {
                    return "1";
                }, "1")
                .addFunctions((i) -> {
                    try {
                        Thread.sleep(1000);
                    } catch (InterruptedException e) {
                        throw new RuntimeException(e);
                    }
                    System.out.println(2);
                    return "2";
                }, "2")
                .run();
        System.out.println(1);
        System.out.println(run.toString());
    }
    @Test
    public  void main2() {
         new BfThreadPoolNoReturnUtils()
                .addConsumers((i) -> {
                }, "1")
                .addConsumers((i) -> {
                    try {
                        Thread.sleep(1000);
                    } catch (InterruptedException e) {
                        throw new RuntimeException(e);
                    }
                    System.out.println(2);
                }, "2")
                .run();
        System.out.println(123);
    }
}
